﻿<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0, user-scalable=no">
    <title>欢迎登录仰恩说</title>
    <!-- <link rel="stylesheet"
          href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script> -->
    <link rel="stylesheet"
          href="dist/css/bootstrap.min.css">
    <script src="dist/js/jquery-2.1.4.min.js"></script>
    <script src="dist/js/bootstrap.min.js"></script>
    
    <script type="text/javascript">
    var xmlhttp;
	var result;
	function createXMLHttpRequext() {
		if (window.ActiveXObject) {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} else if (window.XMLHttpRequest) {
			xmlhttp = new XMLHttpRequest();
		}
	}
	function login() {
		var userNumber = document.getElementById("firstname").value;
		var password = document.getElementById("inputPassword").value;
		createXMLHttpRequext();
		xmlhttp.open("POST","Login",true);
		xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
		//xmlhttp.setRequestHeader("Content-Type", "text/html;charset=UTF-8");
		xmlhttp.onreadystatechange = resultCallback;
		xmlhttp.send("userNumber=" + userNumber + "&password=" + password);
	}
	function resultCallback() {
		if (xmlhttp.readyState == 4) {
			result = xmlhttp.responseText;
			if(result == "0"){//返回0表示登录成功
				window.location.href="Index";
			}else{
				document.getElementById("inputPassword").value = "";
				alert(result);
			}
		}
	}
    
    </script>
    
</head>
<body style="background-image: url(images/login_bg_0.jpg);background-size:cover">
<div class="container">
    <div class="row clearfix">
        <div class="col-md-4 column">
        </div>
        <div class="col-md-4 column">
            <div class="panel panel-info"style="margin-right: auto;margin-left: auto;margin-top: 150px;box-shadow: #666 0px 0px 10px">
            <div class="panel-heading">
                <p class="text-center h4"><img alt="140x140" src="images/favicon.ico"
                                               class="img-circle" width=25px/>欢迎登录仰恩说</p><span id="hhh"></span>
            </div>
            <div class="panel-body">
                <div class="form-horizontal" >
                    <div class="form-group">
                        <div class="col-sm-10" style="margin-left:8%">
                            <span class="glyphicon glyphicon-user"
                                  style="position: absolute;top: 10px;left: 25px"></span>
                            <input type="text" class="form-control" id="firstname" name="userNumber"
                                   placeholder="请输入学号" style="padding-left: 30px">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-10" style="margin-left:8%">
                            <span class="glyphicon glyphicon-eye-close"
                                  style="position: absolute;top: 10px;left: 25px"></span>
                            <input type="password" class="form-control" id="inputPassword" name="password"
                                   placeholder="请输入密码" style="padding-left: 30px">
                        </div>
                    </div>
                    <hr style="margin-top: 30px">
                    <a class="btn btn-default  btn-sm" href="repassword.jsp" role="button">忘记密码?</a>
                    <a class="btn btn-default  btn-sm" href="regist.jsp" role="button">注册</a>
                        <button class="btn btn-primary btn-sm"  onclick="login()"
                                style="float: right">登陆
                        </button>
                </div>
            </div>
        </div>
    </div>
    <div class="col-md-4 column">
    </div>
</div>
</div>
</body>
</html>
